<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="Administracion de Productos"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form">
                <c:if test="#{commonBean.productosAdmon}">
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:outputText escape="false" value="No Existen Productos" rendered="#{productController.items.rowCount == 0}"/>
                    <h:panelGroup rendered="#{productController.items.rowCount > 0}">
                        <h:outputText value="#{productController.pagination.pageFirstItem + 1}..#{productController.pagination.pageLastItem + 1}/#{productController.pagination.itemsCount}"/>&nbsp;
                        <h:commandLink action="#{productController.previous}" value="#{bundle.Previous} #{productController.pagination.pageSize}" rendered="#{productController.pagination.hasPreviousPage}"/>&nbsp;
                        <h:commandLink action="#{productController.next}" value="#{bundle.Next} #{productController.pagination.pageSize}" rendered="#{productController.pagination.hasNextPage}"/>&nbsp;
                        <h:dataTable value="#{productController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">

                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Identificacion del Producto"/>
                                </f:facet>
                                <h:outputText value="#{item.productidproduct}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Nombre"/>
                                </f:facet>
                                <h:outputText value="#{item.productname}"/>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Categoria"/>
                                </f:facet>
                                <h:outputText value="#{item.productcategory}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Precio"/>
                                </f:facet>
                                <h:outputText value="#{item.productlistPrice}"/>
                            </h:column>


                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Habilitado"/>
                                </f:facet>
                                <h:outputText value="#{item.productenable}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <h:commandLink action="#{productController.prepareView}" value="Ver Detalle"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{productController.prepareEdit}" value="Modificar"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{productController.destroy}" value="Eliminar"/>
                            </h:column>
                        </h:dataTable>
                    </h:panelGroup>
                    <br />
                    <h:commandLink action="#{productController.prepareCreate}" value="Crear Nuevo Producto"/>
                </c:if>
                <br />
                <br />
                <c:if test="#{commonBean.productosAdmonConsulta}">
                <br />
                <h:commandLink action="#{productController.prepareQuery}" value="Consultas Especiales"/>
                <br />
                <br />
                <h:commandLink action="#{productController.prepareRankingProduct}" value="Consultas Ranking"/>
                </c:if>
                <br />
                <br />
                <h:commandLink value="Regresar al Menu" action="/index" immediate="true" />
                <br />

            </h:form>
        </ui:define>
    </ui:composition>

</html>
